<template>
    <div style="font-weight: bold; font-size: 25px; text-align: center;">供应商档案</div>

    <table border="1" style="border-collapse: collapse; width: 100%; height: 50px;">
        <tr>
            <td :colspan="4" style="width: 100%; height: 70px; font-size: 20px;background-color: lightcyan;">基本信息</td>
        </tr>
        <tr style="height: 70px; text-align: center; ">
            <td style="font-weight: bold;font-size: 17px;">供应商名称</td>
            <td>{{ form.addDtos.vName }}</td>
            <td style="font-weight: bold;font-size: 17px;">供应商编号</td>
            <td>{{ form.addDtos.vNumber }}</td>
        </tr>
        <tr style="height: 70px; text-align: center; ">
            <td style="font-weight: bold;font-size: 17px;">供应商类别</td>
            <td>{{ form.addDtos.vendorTypeId == 6 ? '原料供应商' : form.addDtos.vendorTypeId == 7 ? '零器件供应商' :
                form.addDtos.vendorTypeId == 8 ? '汽车制造商' : form.addDtos.vendorTypeId == 9 ? '医疗材料供应商' :
                    form.addDtos.vendorTypeId == 10 ? '医疗设备供应商' : form.addDtos.vendorTypeId == 11 ? '工程材料供应商' :
                        form.addDtos.vendorTypeId == 12 ? '工程设备供应商' : form.addDtos.vendorTypeId == 13 ? '电子材料供应商' :
                            form.addDtos.vendorTypeId == 14 ? '电子设备供应商' : form.addDtos.vendorTypeId == 15 ? '食品材料供应商' :
                                form.addDtos.vendorTypeId == 16 ? '食品添加剂供应商' : form.addDtos.vendorTypeId == 17 ? '食品包装供应商' : '食品成品供应商'
                }}</td>
            <td style="font-weight: bold;font-size: 17px;">供应商等级</td>
            <td>{{ form.addDtos.vGrade }}</td>
        </tr>
        <tr style="height: 70px; text-align: center; ">
            <td style="font-weight: bold;font-size: 17px;">所在省份</td>
            <td>{{ form.addDtos.provinceId == 1 ? '江苏省' : form.addDtos.provinceId == 2 ? '浙江省' : '湖北省' }}</td>
            <td style="font-weight: bold;font-size: 17px;">所在市区</td>
            <td>{{ form.addDtos.cityId == 1 ? '南京市' : form.addDtos.cityId == 2 ? '杭州市' : '武汉市' }}</td>
        </tr>
        <tr style="height: 70px; text-align: center; ">
            <td style="font-weight: bold;font-size: 17px;">所属行业</td>
            <td>{{ form.addDtos.vIndustry == 1 ? '汽车行业' : form.addDtos.vIndustry == 2 ? '医疗行业' : form.addDtos.vIndustry
                == 2 ? '工程行业' : form.addDtos.vIndustry == 2 ? '电子行业' : '食品行业' }}</td>
            <td style="font-weight: bold;font-size: 17px;">联系人</td>
            <td>{{ form.addDtos.vContact }}</td>
        </tr>
        <tr style="height: 70px; text-align: center; ">
            <td style="font-weight: bold;font-size: 17px;">部门</td>
            <td>{{ form.addDtos.vDepartment }}</td>
            <td style="font-weight: bold;font-size: 17px;">职务</td>
            <td>{{ form.addDtos.vDuty }}</td>
        </tr>
        <tr style="height: 70px; text-align: center; ">
            <td style="font-weight: bold;font-size: 17px;">办公电话</td>
            <td>{{ form.addDtos.bPhone }}</td>
            <td style="font-weight: bold;font-size: 17px;">手机号码</td>
            <td>{{ form.addDtos.vPhone }}</td>
        </tr>
        <tr style="height: 70px; text-align: center; ">
            <td style="font-weight: bold;font-size: 17px;">法人代表</td>
            <td>{{ form.addDtos.vCorp }}</td>
            <td style="font-weight: bold;font-size: 17px;">公司地址</td>
            <td>{{ form.addDtos.vFirmAddress }}</td>
        </tr>
    </table>



</template>

<script setup lang='ts'>
import axios from 'axios'
import { ElMessage, ElMessageBox } from 'element-plus';
import { ref, reactive, onMounted, computed } from 'vue'
import { useRouter, useRoute } from 'vue-router';
const router = useRouter();
const route = useRoute();
import http from '../../../http.js'

const form = reactive({
    addDtos: {
        vendorId: 0,
        vNumber: '',
        vName: '',
        vendorTypeId: 0,
        vGrade: '',
        provinceId: 0,
        cityId: 0,
        vIndustry: 0,
        vContact: '',
        vDepartment: '',
        vDuty: '',
        bPhone: '',
        vPhone: '',
        vCorp: '',
        vFirmAddress: ''
    }
})

//城市
var City = ref([]);
const getCity = (id: number) => {
    axios.get(http.zblnb + '/cg/api/Vendor/CitySelect?ProvinceId=' + id).then(res => {
        if (res.data.code == 200) {
            City.value = res.data.data
        }
        console.log(City.value)
    });
}

//反填供应商
const BlickFill = () => {
    axios.get(http.zblnb + '/cg/api/Vendor/ProductTypeBackfillShow?Id=' + route.query.vendorId).then(res => {
        if (res.data.code == 200) {
            console.log(res.data.data)
            form.addDtos.bPhone = res.data.data[0].bPhone;
            form.addDtos.cityId = res.data.data[0].cityId;
            form.addDtos.vPhone = res.data.data[0].vPhone;
            form.addDtos.provinceId = res.data.data[0].provinceId;
            getCity(form.addDtos.provinceId);
            form.addDtos.vContact = res.data.data[0].vContact;
            form.addDtos.vCorp = res.data.data[0].vCorp;
            form.addDtos.vDepartment = res.data.data[0].vDepartment;
            form.addDtos.vDuty = res.data.data[0].vDuty;
            form.addDtos.vFirmAddress = res.data.data[0].vFirmAddress;
            form.addDtos.vGrade = res.data.data[0].vGrade;
            form.addDtos.vIndustry = res.data.data[0].vIndustry;
            form.addDtos.vName = res.data.data[0].vName;
            form.addDtos.vNumber = res.data.data[0].vNumber;
            form.addDtos.vendorId = res.data.data[0].vendorId;
            form.addDtos.vendorTypeId = res.data.data[0].vendorTypeId;
        }
    })
}


onMounted(() => {
    BlickFill();
})


</script>

<style></style>